<template>
  <div class="top">
    <div class="left">
      <div class="lbnt" @click="goHome">首页</div>
    </div>
    <div class="center">
      <div class="title">智慧旅游可视化大数据平台</div>
    </div>
    <div class="right">
      <div class="rbtn">统计报告</div>
      <div class="lbtn">当前时间：{{ time }}</div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onUnmounted } from "vue";
import { useRouter } from "vue-router";
let useRoute = useRouter();

const time = ref(new Date().toLocaleTimeString());

const updateTime = () => {
  time.value = new Date().toLocaleTimeString();
};

const interval = setInterval(updateTime);

onUnmounted(() => {
  clearInterval(interval);
});
const goHome = () => {
  useRoute.push("/home");
};
</script>

<style scoped lang="scss">
.top {
  width: 100%;
  height: 40px;
  display: flex;
  .right {
    flex: 1;
    background: url(../images/dataScreen-header-left-bg.png) no-repeat;
    background-size: 100% 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .rbtn {
      width: 150px;
      height: 40px;
      background: url(../images/dataScreen-header-btn-bg-r.png) no-repeat;
      background-size: 100% 100%;
      text-align: center;
      line-height: 40px;
      color: #29fcff;
      font-size: 20px;
    }
    .lbtn {
      color: #29fcff;
      font-size: 20px;
      margin-right: 10px;
    }
  }
  .left {
    flex: 1;
    background: url(../images/dataScreen-header-left-bg.png) no-repeat;
    background-size: 100% 100%;
    .lbnt {
      width: 150px;
      height: 40px;
      float: right;
      background: url(../images/dataScreen-header-btn-bg-l.png) no-repeat;
      background-size: 100% 100%;
      text-align: center;
      line-height: 40px;
      color: #29fcff;
      font-size: 20px;
    }
    .lbnt:hover {
      font-size: 25px;
      cursor: pointer;
    }
  }
  .center {
    flex: 2;
    .title {
      height: 74px;
      width: 100%;
      background: url(../images/dataScreen-header-center-bg.png) no-repeat;
      background-size: 100% 100%;
      text-align: center;
      color: #c8f0f0;
      font-weight: 550;

      line-height: 74px;
      font-size: 30px;
    }
  }
}
</style>
